package cn.bocweb.spinning.model.Bean;

import android.content.Context;
import android.content.SharedPreferences;

import java.util.List;

import cn.bocweb.spinning.util.Constant;

/**
 * Created by chenchangxing on 16/1/13.
 */
public class LibListBean {


    private String msg;
    private int return_code;

    private List<DataEntity> data;

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public void setReturn_code(int return_code) {
        this.return_code = return_code;
    }

    public void setData(List<DataEntity> data) {
        this.data = data;
    }

    public String getMsg() {
        return msg;
    }

    public int getReturn_code() {
        return return_code;
    }

    public List<DataEntity> getData() {
        return data;
    }

    public static class DataEntity {
        private String id;
        private String title;
        private int num;
        private String totalScore;
        private String requireScore;
        private String timelimit;
        private int total;

        public void setId(String id) {
            this.id = id;
        }

        public void setTitle(String title) {
            this.title = title;
        }

        public void setNum(int num) {
            this.num = num;
        }

        public void setTotalScore(String totalScore) {
            this.totalScore = totalScore;
        }

        public void setRequireScore(String requireScore) {
            this.requireScore = requireScore;
        }

        public void setTimelimit(String timelimit) {
            this.timelimit = timelimit;
        }

        public void setTotal(int total) {
            this.total = total;
        }

        public String getId() {
            return id;
        }

        public String getTitle() {
            return title;
        }

        public int getNum() {
            return num;
        }

        public String getTotalScore() {
            return totalScore;
        }

        public String getRequireScore() {
            return requireScore;
        }

        public String getTimelimit() {
            return timelimit;
        }

        public int getTotal() {
            return total;
        }

        public void readLibListIntoLocal(Context context) {
            SharedPreferences sp = context.getSharedPreferences(Constant.WARE_HOUSE, Context.MODE_PRIVATE);
            this.id = sp.getString("id", "");
            this.title = sp.getString("title", "");
            this.num = sp.getInt("num", 0);
            this.totalScore = sp.getString("totalScore", "");
            this.requireScore = sp.getString("requireScore", "");
            this.timelimit = sp.getString("timelimit", "");
            this.total = sp.getInt("total", 0);
        }

        public void writeLibListIntoLocal(Context context) {
            SharedPreferences sp = context.getSharedPreferences(Constant.WARE_HOUSE, Context.MODE_PRIVATE);
            SharedPreferences.Editor editor = sp.edit();
            editor.putString("id", id);
            editor.putString("title", title);
            editor.putInt("num", num);
            editor.putString("totalScore", totalScore);
            editor.putString("requireScore", requireScore);
            editor.putString("timelimit", timelimit);
            editor.putInt("total", total);
            editor.commit();
        }
    }
}
